# -*-encoding: utf-8 -*-

from PostgrePoolThread import PostgrePoolThread
#import pg
#from Connection_PG import pg_conn

def selectImpl(sql, *param):
    a = PostgrePoolThread(sql, *param)
    a.start()
    a.join()
    #for row in a.showResult():
    #    print row['ID']
    return a.showResult()
    #query_select = pgdb_conn.query(sql_select)
    #return query_select.dictresult()

def updateImpl(sql, *param):
    a = PostgrePoolThread(sql, *param)
    a.start()
    a.join()
    return a.showAffectedRows()
    #query_update = pgdb_conn.query(sql_insert)
    #return query_update

def insertImpl(sql, *param):
    a = PostgrePoolThread(sql, *param)
    a.start()
    a.join()
    return a.showAffectedRows()
    #query_insert = pgdb_conn.query(sql_insert)
    #return query_insert

def deleteImpl(sql, *param):
    a = PostgrePoolThread(sql, *param)
    a.start()
    a.join()
    return a.showAffectedRows()
    #query_delete = pgdb_conn.query(sql_delete)
    #return query_delete
